Help for functions and procedures in screenio.e
screenio.e is used to read all the fields
entered on a screen.
Press the tab and backtab keys to move from
one field to another, and
when the Enter key is pressed, all the
fields are read into a
sequence at one time.
Syntax: include screenio.e
a = ReadScreen({s, i}) or
a = ReadScreen({s})
Description: Read values of fields on formatted fields s and return values
into sequence a. The same variable can be used for the first
argument and the result, since
the fields returned will
be in the same format.
Specify the
optional integer i to position the cursor.
If errors checking is done on
the input fields, i is the
field number.
Comments: You must have first set
the values of sequence fields with
function SetUpFields.
Ex. fields = SetUpFields(tag, screen1)
Example 1:
sequence fields, Company,
Account
fields = ReadScreen({fields})
Company = fields[1][VALUE]
Account = fields[2][VALUE]
Example 2:
sequence fields, Company,
Account
integer errors, fieldno
errors = 0
fieldno = 1
while 1 do
fields = ReadScreen({fields, fieldno})
Name = fields[1][VALUE]
Company = fields[2][VALUE]
if not equal(Company, "ABC") then
errors = 1
fieldno = 2
fields[3][VALUE] =
"Invalid Company entered"
field[2][FIELDCOLOR] = RED
RefreshScreen(fields)
end if
if errors = 0 then
exit
end if
end while
See
also: SetUpFields,SetUpFields2,RefreshScreen
Syntax: RefreshScreen(s)
Description: Redisplays the screen with updated values of sequence s.
Comments: Use to redisplay the screen when a field is
updated.
Function SetUpFields must first be executed.
This function may also be used
to display fields on a screen
where all the fields are display
only (protected)
Example:
sequence fields, screen, tag,
Company
tag = {{"@", "P", YELLOW},
"#"}
screen = {"Company name
@ # "}
Company =
"ABC"
fields = SetUpFields(tag, screen)
fields[1][VALUE] = Company
RefreshScreen(fields)
See also: SetUpFields, SetUpFields2, ReadScreen
Syntax: include screenio.e
a = SetUpFields(tag, screen)
Description: a is the sequence returned that contains information about the
fields on the screen (row, col,
length, current position,
protected/unprotected, color,
and value.)
tag contains the display
attributes of the fields:
(Special character;
U-Unprotected or P-Protected;
and field color)
screen is the sequence that is
displayed, without the
starting and ending special
characters.
Comments:
Example: tag = {
{"@",
"U", BRIGHT_WHITE},
{"$", "P", RED},
"#"
}
The last tag description (in
this example, #) is the end of
field marker.
screen = {
"Name : @ #
",
"Company:@ # ",
" ",
"Messages: ",
"$ # "
}
There are three fields on this
screen, two unprotected fields
and one protected field. Protected fields are skipped when
using ReadScreen, since they
cannot be changed.
There are constants set up for
the following values:
ROW = 1, COL = 2, FIELDLEN = 3,
CURRCOL = 4, PROTECTED = 5,
FIELDCOLOR = 6, VALUE = 7
Additional
Comments:
If the text color of the tag
field is the same color
as the background, an invisible,
or password field can
be created.
Example:
sequence tag, screen, fields,
Name, Company
integer errors, fieldno
screen = {
"Name : @ #
",
"Company:@ # ",
" ",
"Messages: ",
"$ # "
}
tag = {
{"@",
"U", BRIGHT_WHITE},
{"$",
"P", RED},
"#"
}
text_color(GREEN) bk_color(BLUE)
clear_screen()
fields = SetUpFields(tag,
screen)
fieldno = 1
while 1 do
fields = ReadScreen({fields, fieldno})
Name = fields[1][VALUE]
Company = fields[2][VALUE]
if not equal(Company,
"ABC") then
errors = 1
fieldno = 2
field[3][VALUE] =
"Company must be ABC"
field[2][FIELDCOLOR] = RED
RefreshScreen(fields)
end if
if errors = 0 then
exit
end if
end while
See also:
ReadScreen, Refresh
Screen, SetUpFields2
Syntax: include screenio.e
a = SetUpFields2(tag, screen)
SetUpFields2 is similar to
SetUpFields, except that the tag characters
are used to set the field
lengths and there is no ending tag character.
Description: a is the sequence returned that contains information about the
fields on the screen (row, col,
length, current position,
protected/unprotected, color,
and value.)
tag contains the display attributes
of the fields:
(Special character;
U-Unprotected or P-Protected;
and field color)
screen is the sequence that is
displayed, without the
starting and ending special
characters.
Comments:
Example: tag = {
{"@",
"U", BRIGHT_WHITE},
{"$", "P", RED}
}
The last tag description (in
this example, #) is the end of
field marker.
screen = {
"Name :
@@@@@@@@@@@@@@@@@@ ",
"Company:
@@@ ",
" ",
"Messages: ",
"$$$$$$$$$$$$$$$$$$$$$$$$$$
"
}
There are three fields on this
screen, two unprotected fields
and one protected field. Protected fields are skipped when
using ReadScreen, since they
cannot be changed.
There are constants set up for
the following values:
ROW = 1, COL = 2, FIELDLEN = 3,
CURRCOL = 4, PROTECTED = 5, FIELDCOLOR
= 6, VALUE = 7
Additional
Comments:
If the text color of the tag
field is the same color
as the background, an invisible,
or password field can
be created.
Example:
sequence tag, screen, fields,
Name, Company
integer errors, fieldno
screen = {
"Name : @ #
",
"Company:@ # ",
" ",
"Messages: ",
"$ # "
}
tag = {
{"@",
"U", BRIGHT_WHITE},
{"$",
"P", RED}
}
text_color(GREEN) bk_color(BLUE)
clear_screen()
fields = SetUpFields(tag,
screen)
fieldno = 1
while 1 do
fields = ReadScreen({fields, fieldno})
Name = fields[1][VALUE]
Company = fields[2][VALUE]
if not equal(Company,
"ABC") then
errors = 1
fieldno = 2
field[3][VALUE] =
"Company must be ABC"
field[2][FIELDCOLOR] = RED
RefreshScreen(fields)
end if
if errors = 0 then
exit
end if
end while
See also:
ReadScreen, Refresh
Screen, SetUpFields